In a network-based architecture, applications running on a client computer or a server computer initiate numerous requests to send data over a network to an intended destination. Each of these requests is associated with significant overhead involving multiple context switching (e.g., from user mode to kernel mode and back) and multiple copying of data (e.g., from application memory to a kernel buffer and between different kernel buffers). The above excessive data copying and context switching can be reduced using a mechanism known as “zero copy transmission.” In Linux environment, for example, this mechanism allows an application to request transmission of data by issuing a mmap system call that asks the operating system for a kernel buffer. The operating system reserves the buffer and returns to the application, which uses the kernel buffer to store the data and then issues a system call. The system call invokes the networking stack engine and returns to the application. The networking stack engine splits the data into packets and attaches headers to the data packets. The data packets are then passed to the network device driver, and a packet destructor is called to notify the operating system that it can reuse the kernel buffer.
Zero copy transmission eliminates unnecessary data duplication, thus decreasing overhead and improving performance. However, zero copy transmission has several limitations that complicate its use by existing applications, operating systems and network devices. In particular, an application typically has to request a kernel buffer to store its data and then has to issue a system call that invokes the networking stack engine. This system call returns immediately, and the application is no longer allowed to change the buffer. If the application needs to send more data for transmission, the application has to request a new kernel buffer. This increases the number of system calls, negatively affecting system performance. In addition, the operating system cannot reuse the kernel buffer until networking stack processing is completed and the data packets are passed to the network device. Further, existing mechanisms apply a zero copy transmission to all data provided by the application, and do not allow a zero copy transmission of only some of the data packets or only some portions of a data packet. Moreover, existing zero copy transmission mechanisms can only work with network devices that support checksum calculations for current protocols. Hence, zero copy transmission cannot be used if a network device cannot calculate checksums or does not recognize the current protocol.